﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MercadoFichajes_MercaFicha : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        GFLEntities2 pe = new GFLEntities2();
        gdMercado.DataSource = pe.Mercado.ToList();
        gdMercado.DataBind();
    }

    protected void gdMercado_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if(e.Row.DataItem != null)
        {
            Mercado item = (Mercado)e.Row.DataItem;
            if (item.cesion)
            {
                e.Row.Cells[10].Text = "Sí";
                TextBox txt = (TextBox)e.Row.Cells[10].FindControl("txtOfertaCesion");
                    if(txt != null)
                        txt.ReadOnly = false;
            }
            else
            {
                e.Row.Cells[10].Text = "No";
                TextBox txt = (TextBox)e.Row.Cells[10].FindControl("txtOfertaCesion");
                if (txt != null)
                    txt.BackColor = Color.Gray;
            }
            if (item.intercambio)
            {
                ImageButton img = (ImageButton)e.Row.Cells[11].FindControl("btnIntercambio");
                    if(img != null)
                        img.Visible = true; 
            }

        }
    }

}